class Event {

    static hasMany = [ positions: Position ]

    String name
    String description
    String location
    UserAccount administrator
    Date startDate
    Date endDate

   static constraints = {
        name(nullable: false, unique: true, blank: false)
        description(nullable: false, size:0..50, blank: false)
        location(size:0..20)
     startDate()
     endDate(validator:{val, obj->
     return val.after(obj.startDate)
     })
     
        
        }
  String toString(){
          name
      }

  static mapping = {
    cache true
  }
  
}